package com.caiyigo.baihua.shiro;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletContext;

import org.beetl.core.GroupTemplate;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;

public class BeetlGroupUtilConfigurationExt extends BeetlGroupUtilConfiguration {
	private  static String CONTEXT_PATH;
	public void setServletContext(ServletContext sc) {

		webPath = sc.getRealPath("/");
		root = webPath + root;
		CONTEXT_PATH=sc.getContextPath();  

	}

	@Override
	protected void initOther() {
		GroupTemplate gt = this.getGroupTemplate();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("CONTEXT_PATH",CONTEXT_PATH);
		gt.setSharedVars(map);
		gt.registerFunctionPackage("so", new ShiroExt());
	}
}
